
-- 使用方法：复制到mod环境，修改 配方名前缀、商品信息、i3o_RerollWares改个名字

--配方名前缀喵
local recname = "wanderingtradershop_i2" 
--商品信息
local NewWares = {  
    ["moonrocknugget"] = { --商品prefab
        min = 1, max = 3, limit = 8,    --进货最小值、进货最大值、库存最大值   （16分钟进货一次）
        ingredients = {Ingredient("inv_if11", 5),},    --配方
        numtogive = 5,     --每次交易数量(可nil)
        des = "以旧换新，你不会拒绝的",   --配方描述（可nil）
    },
}

for product, v in pairs(NewWares) do
    local recipename = recname..product
    STRINGS.RECIPE_DESC[string.upper(recipename)] = v.des
    v.recipe = recipename
    AddRecipe2(recipename, v.ingredients, TECH.LOST, 
    {limitedamount = true, nounlock = true, actionstr="WANDERINGTRADERSHOP", sg_state="give", 
    product = product, numtogive = v.numtogive, description = recipename})
end

local function RerollWares(inst, ...)
    inst:AddWares(NewWares)
    return inst.i3o_RerollWares(inst, ...)
end

AddPrefabPostInit("wanderingtrader", function(inst)
    if inst.RerollWares then
        inst.i3o_RerollWares = inst.RerollWares
        inst.RerollWares = RerollWares
    end
end)